<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>Form Layouts</title>

    <?php $this->load->view('library/header');?>
</head>

<body class="sticky-header">

<section>
    <?php $this->load->view('library/left');?>

    <!-- main content start-->
    <div class="main-content" >

        <?php $this->load->view('library/top');?>

        <!-- page heading start-->
        <div class="page-heading">
            <h3>
                修改密码
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">Forms</a>
                </li>
                <li class="active"> Forms Layouts </li>
            </ul>
        </div>
        <!-- page heading end-->

        <!--body wrapper start-->
        <section class="wrapper">
            <!-- page start-->

            <div class="row">
                <div class="col-lg-12">
                    <section class="panel">
                        <div class="panel-body">
                            <form class="cmxform form-horizontal adminex-form" id="commentForm" method="post" action="">
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">旧的密码</label>
                                <div class="col-sm-10">
                                    <input type="password" value="" name="old_pass" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">新密码</label>
                                <div class="col-sm-10">
                                    <input type="password" value="" name="new_pass" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">确认密码</label>
                                <div class="col-sm-10">
                                    <input type="password" value="" name="con_pass" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 col-sm-2 control-label"></label>
                                <div class="col-lg-10">
                                    <button type="submit" class="btn btn-primary">Submit</button>
                                </div>
                            </div>
                            </form>
                        </div>
                    </section>
                </div>
            </div>
            <!-- page end-->
        </section>
        <!--body wrapper end-->

        <!--footer section start-->
        <footer>
            2014 &copy; AdminEx by
        </footer>
        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>

<?php $this->load->view('library/footer');?>

<!--common scripts for all pages-->
<script src="/public/js/scripts.js"></script>
<script type="text/javascript">
    $(function () {
        $('#commentForm').submit(function () {

            var data = new FormData(this);

            $.ajax({
                type: 'POST',
                url: '<?php echo base_url('Admin/update_pass'); ?>',
                data: data,
                success: function (data) {
                    if (data.status === 'warning') {
                        swal({
                            title:   data.info,
                            text: '2秒后关闭',
                            type: data.status,
                            allowOutsideClick: false,
                            timer: 1500,
                            showConfirmButton: false
                        });
                    }
                    
                    if (data.status === 'success') {
                        swal({
                            title:   data.info,
                            text: '2秒后关闭',
                            type: data.status,
                            allowOutsideClick: false,
                            timer: 1500,
                            showConfirmButton: false
                        });
                        window.location.href="<?php echo base_url('login/');?>";
                    }
                },
                dataType:'json',
                cache: false,
                contentType: false,
                processData: false
            });

            return false;
        });
    });
</script>
</body>
</html>
